
import { Button} from 'antd';
import {WeaLocaleProvider, WeaDialog} from "ecCom"
import {observer} from "mobx-react";
import {toJS} from 'mobx';
import ProjectCondition from '../list/projectCondition';
const getLabel = WeaLocaleProvider.getLabel;

@observer
class AddTaskGroupDialog extends React.Component {
    constructor(props) {
        super(props);
        this.state={
            width:1020,
            height:650,
        }
    }

    render() {
        const {taskGroupStore} = this.props;
        const {visible,handleTaskGroupDialog,fieldinfo,form,setFormFields,title} = taskGroupStore;
        return (
            <div>
                <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@xs4eu2`}
	                title={title||getLabel('518194','新建任务分组')}
                    visible={visible}
                    // style= {{width: width, height: dialogHeight}}
                    maskClosable={false}
                    icon="icon-coms-project"
                    iconBgcolor="#217346"
                    onCancel={()=>handleTaskGroupDialog(false)}
                    buttons={this.getDialogButtons()}
                >
                    <ProjectCondition ecId={`${this && this.props && this.props.ecId || ''}_ProjectCondition@yuz6hu`} fieldInfo={fieldinfo} form={form} setFormFields={(v)=>{setFormFields(v)}} />
                </WeaDialog>
            </div>)
    }

    getDialogButtons(){
        const {taskPortalStore,taskGroupStore} = this.props;
        let btn = [];
        btn.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@8kw02t@save`}  type="primary" onClick={()=>{taskGroupStore.saveTaskGroupInfo(taskPortalStore);}}>{getLabel(86,"保存")}</Button>);
        btn.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@n0i4dk@close`}  type="primary" onClick={()=>taskGroupStore.handleTaskGroupDialog(false)}>{getLabel(309,"关闭")}</Button>);
        return btn
    }

}

export default AddTaskGroupDialog;